home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.2 KB | 64 lines | [TEXT/CWIE] |
- // ListHead.h
-
- #ifndef ListHead_h
- #define ListHead_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
- #ifndef Assert_h
- #include "Assert.h"
- #endif
- #ifndef Prepositions_h
- #include "Prepositions.h"
- #endif
-
- template < class Element > class ListLink;
- template < class Element > class ListLoop;
-
- template < class Element >
- class ListHead
- {
- typedef ListLink< Element > Link;
- typedef ListHead< Element > Head;
- typedef ListLoop< Element > Loop;
-
- friend class ListLoop< Element >;
-
- private:
- Link *first;
- Link *last;
-
- Loop *firstLoop; /* mutable */
-
- void Register( Loop& ) const;
- void Unregister( Loop& ) const;
-
- // not implemented:
- ListHead( const ListHead& );
- void operator=( const ListHead& );
-
- public:
- ListHead();
- ~ListHead();
-
- Link *First() const { return first; }
- Link *Last() const { return last; }
-
- bool IsEmpty() const { return first == 0; }
-
- void Add( Link&, BeforeStart );
- void Add( Link&, AfterEnd );
-
- void Add( Link&, Before, const Link& position );
- void Add( Link&, After, const Link& position );
-
- void Add( Link&, Before, const Loop& position );
- void Add( Link&, After, const Loop& position );
-
- void Remove( Link& );
- void RemoveAll();
- };
-
- #endif
-